<?php
/**
*
* 功能描述（管理控制器）
*
* @author suoya <jlusuoya@gmail.com>
* @version 1
*/

class CtrlIndex extends CtrlBase
{
	public $paramCheck = array(
		'adminfo' => array(
			'id' => array("GET", "must", "intval", "positive"),
		),
		'userinfo' => array(
			'id' => array("GET", "must", "intval", "positive"),
		),
	);
	public $perm = array('index', "index.php?action=login.tologin");

	function Index()
	{
		return RT_TPL;
	}

	function AdmInfo()
	{
		$obj = $this->GetModel("admin");
		$data = $obj->GetBaseInfo($this->params['id']);
		if(!$data)
			echo "无此管理员";
		else
		{
			$info = "账号:".$data['name']
				. "\n姓名:".$data['truename']
				. "\n备注:".$data['desp']
				. "\n电话:".$data['mobile']
				. "\n邮箱:".$data['email'];
			echo $info;
		}
		return RT_NONE;
	}

	function UserInfo()
	{
		$obj = $this->GetModel("user");
		$data = $obj->GetBaseInfo($this->params['id']);
		if(!$data)
			echo "无此用户";
		else
		{
			$all_status = array(
				1 => array(0=>'封停', 1=>'积分会员', 5=>'充值会员'),
				2 => array(0=>'封停', 1=>'待审VIP', 5=>'VIP会员')
			);
			$types = array(1=>'个人会员', 2=>'VIP会员');
			$info = "类型:".$types[$data['type']]
				. "\n状态:".$all_status[$data['type']][$data['level']]
				. "\n账号:".$data['name']
				. "\n姓名:".$data['truename']
				. "\n电话:".$data['mobile']
				. "\n邮箱:".$data['email']
				. "\n公司:".$data['com_name']
				. "\n公司电话:".$data['com_tel'];
			echo $info;
		}
		return RT_NONE;
	}
}

